package com.summarecon.qualitycontrol;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

import com.summarecon.database.*;

public class FloorActivity extends Activity {
	ListView listView;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
 		setContentView(R.layout.activity_floor);
 		
 		listView = (ListView) findViewById(R.id.listFloor);
		
		DatabaseLocation dbFloor = new DatabaseLocation(FloorActivity.this);
		dbFloor.open();
		String[] data = dbFloor.getAllRowsAsArraysFloor();
		dbFloor.close();
		Log.i("data", data.toString());
		
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,data);
		listView.setAdapter(adapter);
 
		listView.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> parent, View v,
				int position, long id) {
				Intent myIntent = new Intent(getBaseContext(), BlueprintLocationActivity.class);
				startActivity(myIntent);
				finish();
			}
		});

	}
}
